module Title
{
	export class Pick
	{

		private pagi = new Pagination.Div();

		public init()
		{
			this.pagi.init();
			var thethis = this;

			WindJS.wire(this.pagi, 'onNext', function ()
			{
				thethis.pagi.setIndex(thethis.pagi.getIndex() + 1);
				$('#findBt').click();
			});


			WindJS.wire(this.pagi, 'onNav', function (data: any)
			{
				thethis.pagi.setIndex(data.index);
				$('#findBt').click();

			});

			WindJS.wire(this.pagi, 'onPrev', function ()
			{
				thethis.pagi.setIndex(thethis.pagi.getIndex() - 1);
				$('#findBt').click();
			});

			$('#findBt').on('click', function ()
			{
				window.location.href = "/Title?keyword=" + encodeURIComponent($('#findTb').val()) + "&page=" + encodeURIComponent($('#paginationPageTb').val()) + "&pagesize=30";
			});
			console.log('d');
			$('.pickBt').on('click', function (data)
			{
				console.log('d');
				var modelID = this.getAttribute("data-userid");
				window['pickedId'] = modelID;
				window.close();
			});
		}

	}

}

var s01Title = new Title.Pick();
s01Title.init();
window['pickedId']="";